﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace IEWebSite.Administration
{
    public partial class Software : System.Web.UI.Page
    {
        SqlConnection sqlConn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["SiteIEConnectionString"].ConnectionString);
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void SoftwareBtnAdd_Click(object sender, EventArgs e)
        {

            try
            {
                sqlConn.Open();
                SqlCommand sqlCmd = new SqlCommand("INSERT INTO [SysSoftware] ([SoftwareTitle],CerinteHDW,Versiune) VALUES (@SoftwareTitle,@CerinteHDW,@Versiune)", sqlConn);
                sqlCmd.Parameters.Add(new SqlParameter("@SoftwareTitle", txtSoftware.Text));
                sqlCmd.Parameters.Add(new SqlParameter("@CerinteHDW", txtDescriere.Text));
                sqlCmd.Parameters.Add(new SqlParameter("@Versiune", txtVersiune.Text));
                sqlCmd.ExecuteNonQuery();
                txtVersiune.Text = "";
                txtSoftware.Text = "";
                txtDescriere.Text = "";
            }
            catch (Exception ex)
            {
                lblError.Text = "Eroare: " + ex.Message;
            }
            finally
            {
                sqlConn.Close();
            }
            softwareGvName.DataBind();
        }
    }
}
